package com.buss.base.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;


@Entity
@Table(name="base_dicdata")
@TableGenerator(name="dicdata_pk_sequence",initialValue=1,allocationSize=1,pkColumnName="seq_col",
		pkColumnValue="dicdata_seq",valueColumnName="seq_val",table="base_pk_sequence")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class DicData implements Serializable {

	private static final long serialVersionUID = -3138340651773920332L;

	/**主键*/
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE,generator="dicdata_pk_sequence")
	private Long id;
	
	/**公司编码*/
	@Column(nullable=false,length=20)
	private String companyId;
	
	/**字典编码*/
	@Column(nullable=false,length=20)
	private String code;
	
	/**字典名称*/
	@Column(nullable=false,length=100)
	private String name;
	
	/**备注说明*/
	@Column(length=255)
	private String intro;
	
	/**上级字典编码*/
	@Column(nullable=false,length=20)
	private Long parentId;

	/**排序序号*/
	private Long orderSort;
	
	/**下级数据字典*/
	@Transient
	private List<DicData> nodes;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	public List<DicData> getNodes() {
		return nodes;
	}

	public void setNodes(List<DicData> nodes) {
		this.nodes = nodes;
	}

	public Long getOrderSort() {
		return orderSort;
	}

	public void setOrderSort(Long orderSort) {
		this.orderSort = orderSort;
	}	
}
